#!/usr/local/bin/bash

# Modify these to reflect your configuration.
#Temporary directory
TEMPBASE=/tmp/vgapcharts
#The directory that I am in
STATSDIR=/home/peterh/new_stats

#These are picked up from the Thingy (version 0.4 or later)
TEMPDIR=$TEMPBASE/$SHORTNAME
SOURCEDIR=$BACKUPDIR/$SHORTNAME
TARGETDIR=$HOMEDIR

mkdir $TEMPDIR

pushd .
cd $TEMPDIR

$STATSDIR/xform.pl $SOURCEDIR

rm *.png

for race in race*.data; do
  ploticus -png -prefab stack stackarea=yes data=$race x=1 y=2 y2=3 y3=4 y4=5 name=Bases name2=Planets name3="Cargo Ships" name4="War Ships"
  pngcrush -m 0 stack.png $race.png
  rm stack.png
done

ploticus -png global.ploticus
pngcrush -m 0 out global.png
rm out

popd

for png in $TEMPDIR/*.png; do
  cp $png $TARGETDIR
done

rm $TEMPDIR/*
rmdir $TEMPDIR
